<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<script type="text/javascript">
    var formId = "userGroup";
</script>

<jsp:include page="menuForGroup.jsp"/>

<div class="sub_nav">
    <ul>
        <li>
            <a href="#">
                <img src="<%= request.getContextPath()%>/images/menu/sub_general_on.gif" width="114" height="18"
                     alt="gernal"/>
            </a>
        </li>
    </ul>
</div>

<!--START: conent -->
<div class="content2">
    <div class="insider">
        <div class="corners">
            <div class="corners_top"></div>
            <spring:form id="userGroup" modelAttribute="userGroup" method="post">
                <!-- Mark the type of the submit action -->
                <input type="hidden" id="submitAction" name="submitAction"/>

                <div class="column1">

                    <table width="360" border="0" cellspacing="4" class="formlayout_table"
                           style="margin-left: auto; margin-right: auto;">
                        <tr>
                            <th><label for="Group">Group:</label></th>
                            <td>
                                <c:if test="${OPERATION == 'create'}">
                                    <input type="text" name="name" value="${userGroup.name}" class="input1"
                                           maxlength="255"/>
                                </c:if>
                                <c:if test="${OPERATION == 'edit'}">
                                    ${userGroup.name}
                                </c:if>
                            </td>
                        </tr>

                        <tr>
                            <th><label for="Group Name">Description:</label></th>
                            <td>
                                <spring:input path="description" cssClass="input1" maxlength="255"/>
                            </td>
                        </tr>

                        <tr>
                            <th><label for="Contact Name">Contact Name:</label></th>
                            <td>
                                <spring:input path="contactName" cssClass="input1" maxlength="255"/>
                            </td>
                        </tr>

                        <tr>
                            <th><label for="Contact Email">Contact Email:</label></th>
                            <td>
                                <spring:input path="contactEmail" cssClass="input1" maxlength="255"/>
                            </td>
                        </tr>

                        <tr>
                            <th><label for="Contact Phone">Contact Phone:</label></th>
                            <td>
                                <spring:input path="contactPhone" cssClass="input1" maxlength="255"/>
                            </td>
                        </tr>

                        <tr>
                            <th><label>Last Modified Date:</label></th>
                            <td>
                                <fmt:formatDate value="${userGroup.modifiedOn}" pattern="dd-MMM-yyyy"/>
                            </td>
                        </tr>

                        <tr>
                            <th><label>Last Modified By:</label></th>
                            <td>${userGroup.modifiedBy.username}</td>
                        </tr>
                    </table>
                </div>
            </spring:form>

            <jsp:include page="../common/commonFunction.jsp"/>

            <div class="corners_bottom"></div>
        </div>

        <div class="message">
            ${message}
            ${empty message ? '' : '<br />'}

            <div style="color:red">
                ${errors['name.errors'][0]}
                ${empty errors['name.errors'] ? '' : '<br />'}

                ${errors['description.errors'][0]}
                ${empty errors['description.errors'] ? '' : '<br />'}

                ${errors['contactName.errors'][0]}
                ${empty errors['contactName.errors'] ? '' : '<br />'}

                ${errors['contactEmail.errors'][0]}
                ${empty errors['contactEmail.errors'] ? '' : '<br />'}

                ${errors['contactPhone.errors'][0]}
                ${empty errors['contactPhone.errors'] ? '' : '<br />'}
            </div>
        </div>
    </div>
</div>
<!--END: conent -->